<template>
  <div id="app">
    <h3>⽤户登录</h3>
    <form>
      ⽤户名：<input type="text" v-model="myForm.username" /><br>
      密码：<input type="password" v-model="myForm.password" /><br>
      <input type="button" value="登录" @click="login" />
    </form>
  </div>
</template>
<script>
export default {
  data() {
    return {
      myForm: {
        username: '',
        password: ''
      }
    }
  },
  methods: {
    login: function() {
      if(this.myForm.username=='admin'&&this.myForm.password=='admin'){
        this.$store.commit('changeLogin',true)
        this.$router.push("/routerindex");
      }else{
        alert("⽤户名密码错误")
      }
    }
  }
}
</script>